package com.winit.mq.exchange;

import com.winit.mq.broker.MessageBroker;
import com.winit.mq.message.Message;
import com.winit.util.ObjectToString;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * Created by xiangyu.liang on 2016/8/15.
 */
@Component
public class MessageExchange {

    private static Logger logger = LoggerFactory.getLogger(MessageExchange.class);


    public void sendMessage(String queueName, Message message){
        MessageBroker messageBroker= MessageBroker.getInstance();
        messageBroker.sendMessage(queueName,message);
        logger.info("com.winit.core.mq.exchange.MessageExchange.sendMessage queueName="+queueName+","+ ObjectToString.getString(message));
    }
}
